HTMLify
style.css
Views: 19 | Author: cody
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500&display=swap"); *, *::after, *::before { margin: 0; padding: 0; box-sizing: border-box; } html { font-size: 62.5%; } body { width: 100vw; min-height: 100vh; background-color: #f0f0f0; font-family: "Poppins", sans-serif; display: flex; justify-content: center; align-items: center; } .container { position: relative; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; } .container .box { position: relative; width: 30rem; height: 30rem; margin: 4rem; } .container .box:hover .imgBox { transform: translate(-3.5rem, -3.5rem); } .container .box:hover .content { transform: translate(3.5rem, 3.5rem); } .imgBox { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; transition: all 0.5s ease-in-out; } .imgBox img { width: 30rem; height: 30rem; object-fit: cover; resize: both; } .content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; padding: 1.5rem; display: flex; justify-content: center; background-color: #fff; z-index: 1; align-items: flex-end; text-align: center; transition: 0.5s ease-in-out; } .content h2 { display: block; font-size: 2rem; color: #111; font-weight: 500; line-height: 2rem; letter-spacing: 1px; } .content span { color: #555; font-size: 1.4rem; font-weight: 300; letter-spacing: 2px; } @media (max-width: 600px) { .container .box:hover .content { transform: translate(0, 3.5rem); } .container .box:hover .imgBox { transform: translate(0, -3.5rem); } } |